<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>个人资料</title>
    <link rel="stylesheet" th:href="@{/src/css/layui.css}">
</head>
<body>
<form class="layui-form" style="width:80%;" id="arf">
    <input type="hidden" name="id" th:value="${admin.id}">
    <div class="layui-form-item">
        <label class="layui-form-label">账户</label>
        <div class="layui-input-block">
            <input type="text" readonly class="layui-input userName" lay-verify="required"
                 name="account" th:value="${admin.account}">
            <label>（<span style="color: red">*</span>5-16位字母组成</label>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">邮箱</label>
        <div class="layui-input-block">
            <input type="text" class="layui-input email" lay-verify="required"
                  name="email" th:value="${admin.email}">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">姓名</label>
        <div class="layui-input-block">
            <input type="text" class="layui-input adminName" lay-verify="required"
               name="adminName" th:value="${admin.adminName}">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">证件</label>
        <div class="layui-input-block">
            <input type="text" class="layui-input adminCard" lay-verify="required"
                  name="adminCard" th:value="${admin.adminCard}">
            <label>（<span style="color: red">*</span>请输入15/18位身份证号码</label>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">手机号</label>
        <div class="layui-input-block">
            <input type="text" class="layui-input phone" lay-verify="required"
                   placeholder="请输入手机号码" name="phone" th:value="${admin.phone}">
        </div>
    </div>

    <div class="layui-form-item" style="margin: auto;text-align: center">
        <div class="layui-input-block" style="margin-left: 80px;text-align: center">
            <button class="layui-btn layui-btn-danger" lay-submit="" lay-filter="register" style="width: 100%;border-radius: 5px">立即修改</button>

        </div>
    </div>
</form>
<script th:src="@{/src/layui.js}"></script>
<script th:src="@{/src/js/jquery-1.9.1.min.js}"></script>
<script>

    layui.use(['form','jquery','layer'],function () {
        var form = layui.form,
            $ = layui.jquery,
            layer = layui.layer;

        form.on('submit(register)',function (data) {
            $.ajax({
                url:'/admin/updateAdmin',
                data:data.field,
                type:'put',
                dataType:'json',
                success:function (result) {
                    if(result.code == 200){
                        layer.msg(result.message,{icon:1},function () {
                        })
                    }else{
                        layer.msg(result.message,{icon:5});
                    }
                }
            })

            return false;
        })
    })
</script>
</body>
</html>